﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Silvery;
using Silvery.Role.Standard;
using System.Collections.Generic;
using Silvery.Role;

namespace Sample02_Role
{
    public class Sample_7 : GameRoot
    {
        StandardRole hero;
        public Sample_7()
        {
            hero = new MyStandardRole();
            this.AddBaseObj(hero);
            hero.Position = new Point(300, 200);
            
        }
        private static List<RoleDirection> roledirlist = new List<RoleDirection>()
        {
            RoleDirection.Down,RoleDirection.Left,RoleDirection.LeftDown,RoleDirection.Right,
            RoleDirection.RightDown,RoleDirection.Up,RoleDirection.UpLeft,RoleDirection.UpRight
        };
        private static List<RoleState> rolestatelist = new List<RoleState>()
        {
            RoleState.Wait,RoleState.Run
        };
        public class MyStandardRole : StandardRole
        {
            ComboBox combobox1 = new ComboBox() { Width = 72 };
            ComboBox combobox2 = new ComboBox() { Width = 72 };
            public MyStandardRole()
                : base(new Uri("download/Sample_Role/PC001.zip", UriKind.Relative))
            {
                
            }
            void combobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                this.RoleDir = (RoleDirection)combobox1.SelectedItem;
            }
            void combobox2_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                this.RoleState = (RoleState)combobox2.SelectedItem;
            }
            protected override void OnBodyPackLoaded()
            {
                base.OnBodyPackLoaded();
                this.Children.Add(combobox1);
                Canvas.SetLeft(combobox1, -36);
                Canvas.SetTop(combobox1, 40);
                combobox1.ItemsSource = roledirlist;
                combobox1.SelectionChanged += new SelectionChangedEventHandler(combobox_SelectionChanged);

                this.Children.Add(combobox2);
                Canvas.SetLeft(combobox2, -36);
                Canvas.SetTop(combobox2, 64);
                combobox2.ItemsSource = rolestatelist;
                combobox2.SelectionChanged += new SelectionChangedEventHandler(combobox2_SelectionChanged);

                combobox1.SelectedIndex = 0;
                combobox2.SelectedIndex = 0;
            }
        }
    }
}
